<?php
/*======================================================
 * Pagina principal de el Dashboard de Meoewsletter C:
 * =====================================================
 * 
 * 
 * En este archivo permite verificar 
 * */

//esta me ayuda siempre a direccionar al root :)
//if(($_SERVER['SCRIPT_FILENAME']) == ($_SERVER['DOCUMENT_ROOT']."/Meowsletter/index.php"))


//iniciamos session para usar datos ya cargados :D
session_start ();

//verificamos si hay session en menoria
if (! empty ( $_SESSION )) {
	$scp_finenane = ($_SERVER ['SCRIPT_FILENAME']);
	
	if (! ($scp_finenane == $_SESSION ['MLPath'] . "dashboard/index.php")) {
		
		/*print $_SESSION ['MLPath'] . "<br/>";
		print $_SESSION ['MLSources'] . "<br/>";
		print $_SESSION ['MLEngine'] . "<br/>";
		print $_SESSION ['MLDealers'] . "<br/>";
		print $_SESSION ['MLTemplates'] . "<br/>";
		*/
		if (! defined ( $_SESSION ['MLEngine'] )) {
			@define ( 'MLEngine', $_SESSION ['MLEngine'] );
			@define ( 'MLSources', $_SESSION ['MLSources'] );
			@define ( 'MLPath', $_SESSION ['MLPath'] );
			@define ( 'MLDealers', $_SESSION ['MLDealers'] );
			@define ( 'MLTemplates', $_SESSION ['MLTemplates'] );
		
		}
		require_once (MLEngine . 'MakiFactory/MakiFactory.php');
		$usermaki = new User ();
		$usermaki = $_SESSION ["user"];
		print ("<br/>Bienvenido " . $usermaki->getNomuser () . " al dashboard de Meowsletter") ;
		print ("<br/><a href='logout.php'><b>Salir</b></a>") ;
		
		$boletinmaki = new Boletin ();
	} else {
		
		header ( "Location: ../index.php " );
	}

} else {
	
	if (defined ( 'MLEngine' )) {
		//usamos la autenticacion
		require 'dashboard/auth.php';
	} else {
		header ( "Location: ../index.php " );
	}

}

?>